(0.2.3) Practice and verification
What should you do if you want to output "Bye, world!" in Python? By finding the pattern, you gain the ability to come up with the following code.
code: Patterns you found
print("What you wrote here is displayed")
code:code that seems to output "Bye, world!"
print("Bye, world!")
However, this is just a hypothesis. You don't know if the code will output "Bye, world!" without trying it. If you run it, you'll see that you can achieve the purpose for this particular example.
Let's look at another example. Suppose you want to output "Hello, (line break) world!" on two consecutive lines, how should you do it? If your hypothesis is correct, you should write it like this.
code:code that seems to output "Hello,(line break)world!"
print("Hello,
world!")
If you try the code, you'll see that the code causes a syntax error and doesn't work as expected. It is not a failure. You found concrete information that your hypothesis doesn't fit for this case. It is an opportunity for learning. Why does the code not work as you thought? --- By thinking like this, you can deepen your understanding.
https://gyazo.com/67d11a4e6502bd99f657635d62e670d8
In this example, you discovered the fact that "when you want to print a line break, it does not work if you simply wrap a line." Your next action is to look for solutions to this problem. For example, you can find a sample code that includes useful information using search engines. For a concrete example, you can query "Python new line print" on Google search. That sample code will not directly tell you how to achieve your goal of outputting "Hello, (line break) world!". It is a code to display something different. However, if you compare this new sample code with the information you collected so far, you will find another pattern, and you can create a new hypothesis about how to implement it to achieve the goal.
Concrete information gathering, comparison and pattern discovery, practice and verification, a gap between expectation and reality, and then gathering more information. By repeating this cycle, you can obtain programming abilities. By repeating the cycle, you get the power to create a new program. The same pattern exists for learning intellitechs. You need to repeat the cycle of concrete information gathering, comparison and pattern discovery, practice and verification.
en.icon
---
This page is auto-translated from /nishio/(0.2.3) Practice and verification. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I'm very happy to spread my thought to non-Japanese readers.